<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=2,minimum-scale=1,maximum-scale=1,user-scalable=no">
	<link rel="stylesheet" href="css/tg_mobile_reset.css">
	<title>纯随想测试</title>
	<style>
		.header {/*position: fixed;*/top: 0;left: 0;width: 100%;height: 844px;padding-top: 20px;background-color: salmon;text-align: center;line-height: 44px;box-sizing: border-box;}
	</style>
</head>
<body>


	<div class="header">测试</div>

	<script>
		scrollnum = 0;
		window.onscroll = function() {
		  throttle2(lazyload, 100, 500)() 
		};

		function lazyload(q,p) {
		  scrollnum++;
		  console.log("scroll执行了" + scrollnum);
		  console.log(q)
		  console.log(p)
		}
		function throttle2(method, delay, time) {
		  var timeout, startTime = new Date();
		  return function() {
		    var context = this,
		        args = arguments,
		        curTime = new Date();
		    clearTimeout(timeout);
		    // 如果达到了规定的触发时间间隔，触发 handler
		    if(curTime - startTime >= time) {
		      method.apply(context, args);
		      startTime = curTime;
		      // 没达到触发间隔，重新设定定时器
		    } else {
		      timeout = setTimeout(method, delay);
		    }
		  }
		}

	</script>

	


	<script src="./lib/rem.js"></script>
</body>
</html>